<template>
  <el-row class="tac">
    <el-col :span="40">
      <h5 class="mb-2">Default colors</h5>
      <el-menu default-active="2" class="el-menu-vertical-demo">
        <el-sub-menu index="1">
          <template #title>
            <el-icon>
              <location />
            </el-icon>
            <span>商品管理</span>
          </template>
          <el-menu-item index="1-1" @click="goToAddGoods">添加商品</el-menu-item>
          <el-menu-item index="1-2" @click="goToQueryGoods">商品列表</el-menu-item>
          <el-menu-item index="1-3" @click="manageGoodsType">商品分类管理</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="2">
          <template #title>
            <el-icon>
              <location />
            </el-icon>
            <span>用户管理</span>
          </template>
          <el-menu-item index="2-1" @click="goToAddUser">添加用户</el-menu-item>
          <el-menu-item index="2-2" @click="goToQueryUser">用户列表</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="3">
          <template #title>
            <el-icon>
              <location />
            </el-icon>
            <span>管理员管理</span>
          </template>
          <el-menu-item index="3-1" @click="goToAddAdmin">添加管理员</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="4">
          <template #title>
            <el-icon>
              <location />
            </el-icon>
            <span>订单管理</span>
          </template>
          <el-menu-item index="4-1" @click="goToManageOrders">订单列表</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="5">
          <template #title>
            <el-icon>
              <location />
            </el-icon>
            <span>评论管理</span>
          </template>
          <el-menu-item index="4-1" @click="goToManageComments">评论列表</el-menu-item>
        </el-sub-menu>
      </el-menu>
    </el-col>
  </el-row>
</template>
    
    
<script lang="ts" setup>
import { useRouter } from "vue-router";
import {
  Document,
  Menu as IconMenu,
  Location,
  Setting,
} from '@element-plus/icons-vue'

const router = useRouter()

function goToAddGoods() {
  router.push("/addgoods")
}

function manageGoodsType() {
  router.push("/managegoodstype")
}

function goToQueryGoods() {
  router.push("/querygoods")
}

function goToAddUser() {
  router.push("/adduser")
}

function goToQueryUser() {
  router.push("/queryuser")
}

function goToAddAdmin() {
  router.push("/addadmin")
}

function goToManageOrders() {
  router.push("/ordersmanage")
}

function goToManageComments() {
  router.push("/managecomments")
}
</script>